package presentacion;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.Label;
import java.awt.Font;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JLabel;

import negocio.TransferGeneral;

import java.awt.Component;
import java.awt.geom.Area;

public class PanelUsuarioId extends JPanel {

	/**
	 * Create the panel.
	 */
	public PanelUsuarioId(int dniUsuario) {
		setBackground(Color.WHITE);
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{14, 57, 54, 0, 0, 0, 16, 0};
		gridBagLayout.rowHeights = new int[]{22, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		Label label = new Label("Usuario:");
		label.setForeground(Color.BLACK);
		label.setFont(new Font("Dialog", Font.PLAIN, 11));
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.fill = GridBagConstraints.HORIZONTAL;
		gbc_label.insets = new Insets(0, 0, 0, 5);
		gbc_label.gridx = 1;
		gbc_label.gridy = 0;
		add(label, gbc_label);
		
		Label label_1 = new Label("Nombre Usuario");
		label_1.setForeground(Color.BLUE);
		GridBagConstraints gbc_label_1 = new GridBagConstraints();
		gbc_label_1.anchor = GridBagConstraints.WEST;
		gbc_label_1.insets = new Insets(0, 0, 0, 5);
		gbc_label_1.gridx = 2;
		gbc_label_1.gridy = 0;
		add(label_1, gbc_label_1);
		
		Label label_2 = new Label("Puesto: ");
		GridBagConstraints gbc_label_2 = new GridBagConstraints();
		gbc_label_2.insets = new Insets(0, 0, 0, 5);
		gbc_label_2.gridx = 3;
		gbc_label_2.gridy = 0;
		add(label_2, gbc_label_2);
		
		Label label_3 = new Label("New label");
		label_3.setForeground(Color.BLUE);
		GridBagConstraints gbc_label_3 = new GridBagConstraints();
		gbc_label_3.anchor = GridBagConstraints.WEST;
		gbc_label_3.insets = new Insets(0, 0, 0, 5);
		gbc_label_3.gridx = 4;
		gbc_label_3.gridy = 0;
		add(label_3, gbc_label_3);
		
		JLabel label_4 = new JLabel("");
		GridBagConstraints gbc_label_4 = new GridBagConstraints();
		gbc_label_4.insets = new Insets(0, 0, 0, 5);
		gbc_label_4.gridx = 5;
		gbc_label_4.gridy = 0;
		add(label_4, gbc_label_4);
		
		TransferGeneral datos=new TransferGeneral();
		datos.setDniUsuario(dniUsuario);
		SingletonControlador.getInstancia().evento(Evento.GENERAL_GET_DATOS_USUARIO, datos);
		label_1.setText(datos.getNombre()+" "+datos.getApellido1()+" "+datos.getApellido2());
		label_3.setText(Roles.values()[datos.getPuesto()].toString());
		label_4.setIcon(new ImageIcon(PanelUsuarioId.class.getResource("/imagesPath/logo_pato.png")));
		

		
		
		

	}

}
